package com.twu.biblioteca.view.command;

import com.google.common.collect.Maps;
import com.google.inject.Inject;
import com.google.inject.name.Named;

import java.util.Map;

public class CommandMap {
  private Map<Command.Type, Command> commandMap = Maps.newHashMap();

  @Inject
  public void setLoginCommand(@Named("login") Command command) {
    commandMap.put(Command.Type.Login, command);
  }

  @Inject
  public void setBookListCommand(@Named("bookList") Command command) {
    commandMap.put(Command.Type.BookList, command);
  }

  @Inject
  public void setStartup(@Named("startup") Command command) {
    commandMap.put(Command.Type.StartUp, command);
  }

  @Inject
  public void setCheckoutBookCommand(@Named("checkoutBook") Command command) {
    commandMap.put(Command.Type.CheckOutBook, command);
  }

  @Inject
  public void setReturnBookCommand(@Named("returnBook") Command command) {
    commandMap.put(Command.Type.ReturnBook, command);
  }

  @Inject
  public void setMovieListCommand(@Named("movieList") Command command) {
    commandMap.put(Command.Type.MovieList, command);
  }

  @Inject
  public void setCheckoutMovieCommand(@Named("checkoutMovie") Command command) {
    commandMap.put(Command.Type.CheckOutMovie, command);
  }

  @Inject
  public void setReturnMovieCommand(@Named("returnMovie") Command command) {
    commandMap.put(Command.Type.ReturnMovie, command);
  }

  @Inject
  public void setUserInfoCommand(@Named("userInfo") Command command) {
    commandMap.put(Command.Type.UserInfo, command);
  }

  @Inject
  public void setQuitCommand(@Named("quit") Command command) {
    commandMap.put(Command.Type.Quit, command);
  }

  public Command get(Command.Type type) {
    return commandMap.get(type);
  }
}
